FROM maven:3.8.5-openjdk-17 AS builder
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline -B
COPY src ./src/
RUN mvn package -DskipTests

FROM eclipse-temurin:17-jre
WORKDIR /app
COPY --from=builder /app/target/recommender-service-*.jar /app/recommender-service.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "recommender-service.jar"]